###########################################################
#
# Makefile
#
###########################################################
LOCAL=.
INCDIR=$(LOCAL)/include
SRCDIR=$(LOCAL)/src
OBJDIR=$(LOCA)/objects

VERSION_HEADER=$(INCDIR)/version_info.h



SVN_REV := $(subst Revision:,,$(shell svn info | grep Revision:))
ifeq ($(strip $(SVN_REV)),)
SVN_REV := -1
endif

SVN_URL:= $(subst URL: ,,$(shell svn info | grep URL:))
ifeq ($(strip $(SVN_URL)),)
SVN_URL :=UNKNOWN
endif

SVN_DATE:= $(subst Last Changed Date:,,$(shell svn info | grep Date:))
ifeq ($(strip $(SVN_DATE)),)
SVN_DATE :=UNKNOWN
endif


$(VERSION_HEADER): Makefile
	@echo "/**" > $@
	@echo " *  File: version-info.h" >> $@
	@echo " *  AUTO GENERATED FILE - DO NOT EDIT" >> $@
	@echo " */ " >> $@
	@echo "" >> $@
	@echo "#ifndef __VERSION_INFO_H__" >> $@
	@echo "#define __VERSION_INFO_H__" >> $@
	@echo "" >> $@
	@echo "#define SVN_VERSION $(SVN_REV)" >> $@
	@echo "#define SVN_URL \"$(SVN_URL)\"" >> $@
	@echo "#define SVN_DATE \"$(SVN_DATE)\"" >> $@
	@echo "" >> $@
	@echo "#endif /* __VERSION_INFO_H__ */" >> $@

clean:
	rm -f version_info.h




